cc.Class({

    extends: cc.Component,

    properties: {
        wxCanvas: cc.Sprite,                //微信子域画布
    },

    start() {
        var wx = window.wx;
        if (!wx) return;
        this.tex = new cc.Texture2D();
        this.wxCanvas.node.setLocalZOrder(9);  //设置子域画布的节点排序--数值越大越后显示，不会被遮盖住
    },

    update(dt) {
        var wx = window.wx;
        if (!wx) return;
        this._updaetSubDomainCanvas();
    },
    /**
     * 渲染微信子域画布
     * @private
     */
    _updaetSubDomainCanvas() {

        if (!this.tex) {
            return;
        }
        this.tex.initWithElement(sharedCanvas);
        this.tex.handleLoadedTexture();
        this.wxCanvas.spriteFrame = new cc.SpriteFrame(this.tex);
    },
});
